<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
	  <h:panelGrid columns="2">
		<p:panel header="Ödevlerim">
		    <p:dataGrid columns="1" emptyMessage="Ödeviniz bulunmamaktadır." var="homework" value="#{HomePageBean.studentHomework}">
			  <p:column>
				<h:panelGrid columns="2">
				    <h:outputLabel value="Detaylar"/>
				    <h:outputLabel value="Teslim Tarihi: "/>
				    <h:outputLabel value="#{homework.date.toString()}"/>
				    <h:outputLabel value="#{homework.text}"/>
				    <p:commandLink value="Ödevi gör" action="#{HomePageBean.clickHomework()}">
					  <f:setPropertyActionListener value="#{homework.course}" target="#{CourseBean.target}"/>
					  <f:setPropertyActionListener value="#{homework}" target="#{HomeworkBean.target}"/>
				    </p:commandLink>
				</h:panelGrid>
			  </p:column>
		    </p:dataGrid>
		</p:panel>
		<p:panel header="Cevaplarım">
		    <p:accordionPanel var="ans" value="#{HomePageBean.studentAnswer}">
			  <p:tab>
				<h:panelGrid columns="2">
                                    <h:outputLabel value="Sonuç: "/>
                                    <h:outputLabel value="#{ans.score}"/>
                                    <h:outputLabel value="Okuyan: "/>
                                    <p:commandLink value="${ans.teacher.fullName}" action="#{HomePageBean.clickTeacher()}" ajax="false">
						<f:setPropertyActionListener value="#{ans.teacher}" target="#{TeacherBean.target}"/>
                                </p:commandLink>
                                    <p:commandLink ajax="false" value="Cevabı Gör" onclick="answer.show();">
                                    <f:setPropertyActionListener value="#{ans}" target="#{HomeworkBean.targetAnswer}"/>
				</p:commandLink>
				</h:panelGrid>
			  </p:tab>
		    </p:accordionPanel>
		</p:panel>
	  </h:panelGrid>
	  
	  <p:lightBox style="background-color: white;" id="box" visible="#{HomePageBean.box}" onHide="#{HomePageBean.makeBoxFalse()}" height="300" width="300">
		    <h:outputLink value="#{HomePageBean.sayfaBox}" title="#{HomePageBean.boxTitle}"/>   
	  </p:lightBox>
    </body>
</html>
